﻿using System;
using System.Text;

namespace Utilities
{
    public static class StringGenerator
    {
        public static string Generate(int length, string source = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
        {
            char[] chars = source.ToCharArray();
            StringBuilder builder = new StringBuilder();

            int count = length;
            for (int i = 0; i < count; ++i)
            {
                int r = _random.Next(0, chars.Length - 1);
                builder.Append(chars[r]);
            }

            return builder.ToString();
        }

        private static Random _random = new Random();
    }
}
